package com.ruoyi.contractManagement.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.contractManagement.mapper.DocContractMapper;
import com.ruoyi.contractManagement.domain.DocContract;
import com.ruoyi.contractManagement.service.IDocContractService;

/**
 * 用户签约记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-14
 */
@Service
public class DocContractServiceImpl implements IDocContractService 
{
    @Autowired
    private DocContractMapper docContractMapper;

    /**
     * 查询用户签约记录
     * 
     * @param contractId 用户签约记录主键
     * @return 用户签约记录
     */
    @Override
    public DocContract selectDocContractByContractId(Long contractId)
    {
        return docContractMapper.selectDocContractByContractId(contractId);
    }

    /**
     * 查询用户签约记录列表
     * 
     * @param docContract 用户签约记录
     * @return 用户签约记录
     */
    @Override
    public List<DocContract> selectDocContractList(DocContract docContract)
    {
        return docContractMapper.selectDocContractList(docContract);
    }

    /**
     * 新增用户签约记录
     * 
     * @param docContract 用户签约记录
     * @return 结果
     */
    @Override
    public int insertDocContract(DocContract docContract)
    {
        return docContractMapper.insertDocContract(docContract);
    }

    /**
     * 修改用户签约记录
     * 
     * @param docContract 用户签约记录
     * @return 结果
     */
    @Override
    public int updateDocContract(DocContract docContract)
    {
        return docContractMapper.updateDocContract(docContract);
    }

    /**
     * 批量删除用户签约记录
     * 
     * @param contractIds 需要删除的用户签约记录主键
     * @return 结果
     */
    @Override
    public int deleteDocContractByContractIds(Long[] contractIds)
    {
        return docContractMapper.deleteDocContractByContractIds(contractIds);
    }

    /**
     * 删除用户签约记录信息
     * 
     * @param contractId 用户签约记录主键
     * @return 结果
     */
    @Override
    public int deleteDocContractByContractId(Long contractId)
    {
        return docContractMapper.deleteDocContractByContractId(contractId);
    }
    /**
     * 通过签约id查询订单id
     * @param contractId
     * @return
     */
    public Long selectOrderIdByContractId(Long contractId)
    {
        return docContractMapper.selectOrderIdByContractId(contractId);
    }
    /**
     * 通过订单id查询团队id
     * @param orderId
     * @return
     */
    public Long selectTeamIdByOrderId(Long orderId){
        return docContractMapper.selectTeamIdByOrderId(orderId);
    }
    /**
     * 修改签约状态
     * @param orderId
     */
    public void updateDocContractState(Long orderId) {
        docContractMapper.updateDocContractState(orderId);
    }

    public void updateDocContractState2(Long orderId) {
        docContractMapper.updateDocContractState2(orderId);
    }
    /**
     * 通过订单id查询用户id
     */
    public Long selectUserIdByOrderId(Long orderId) {
        return docContractMapper.selectUserIdByOrderId(orderId);
    }
}
